package cn.hxzy.fallback;

import cn.hxzy.client.ChapterClient;
import cn.hxzy.domain.Chapter;
import cn.hxzy.response.R;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Slf4j
public class ChapterClientFallbackFactory implements FallbackFactory<ChapterClient> {


    @Override
    public ChapterClient create(Throwable throwable) {
        return new ChapterClient(){

            @Override
            public R<List<Chapter>> courseList(Integer courseId) {
                log.error("获取列表失败", throwable);
                return new R<List<Chapter>>();
            }
        };
    }
}
